<!doctype html>
<html>
<head>
	<meta charset="UTF-8" />
	<title>发布拼团产品</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/detail.css" />
</head>
<body>
<div class="detail" id="one">
	<form action="" method="post">
		<div class="form">
			<ul>
				<li><span>商品标题</span><input type="text" name="title" placeholder="请输入标题" value="{$spellgroup['title']}" style="width:75%;" required  /></li>
				<li><a onClick="show(2)"><span>商品主图</span><em></em></a></li>
				<li><span>商品库存</span><input type="number" placeholder="请输入库存" name="num" value="{$spellgroup['num']}" required/><i>份</i></li>
				<li><span>商品原价</span><input type="number" placeholder="请输入原价" name="price" value="{$spellgroup['price']}" step="0.01" required/><i>元</i></li>
				<li><span>拼团价</span><input type="number" placeholder="请输入拼团价" name="actual_price" value="{$spellgroup['actual_price']}" step="0.01" required/><i>元</i></li>
				<li><span>每份分量</span><input type="number" placeholder="请输入分量" name="u_num" value="{$spellgroup['u_num']}" required>
					<select data-placeholder="选择单位" name="unit" class="chosen-select form-control m-b" tabindex="2" style="width: 100px">
						<volist name="list_category" id="vo">
							<option value="{$vo.id}" hassubinfo="true" <?=$vo['id']==$spellgroup['unit']?'selected':''?> >
							{$vo.title}
							</option>
						</volist>
					</select>
				</li>
				<li><span>拼团人数</span><input type="number" placeholder="请输入拼团人数" name="min_num" value="{$spellgroup['min_num']}" style="width:75%;" required/></li>
				<li class="start"><span>拼团开始时间</span>
					<input onfocus="this.blur()" class="form-control layer-date" name="starttime" value="{$spellgroup['starttime']}"  onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" /></li>
				<li class="start"><span>拼团结束时间</span>
					<input onfocus="this.blur()" class="form-control layer-date" name="endtime" value="{$spellgroup['endtime']}"  onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"  /></li>
                <li style="margin-top:10px;"><a onClick="show(4)"><span>拼团须知</span></a></li>
                <li><a onClick="show(3)"><span>商品详情</span></a></li>
			</ul>
		</div>
		<div class="button">
			<input type="hidden" name="s_id">
			<input type="submit" value="{$submit}"/>
		</div>
</div>
  <!--页面二-->
  <input type="hidden" name="h_imgs" value="{$spellgroup.h_imgs}">
  <div class="detail" id="two" style="display:none;">
    <div class="upload">
      <ul>
        <li><img src="{$spellgroup.img1}" <eq name="spellgroup.img1" value="">style="display:none;"</eq> width="176" height="172" id="picShow_1" onClick="upimg('1')"/>
          <div class="inner" <neq name="spellgroup.img1" value="">style="display:none;"</neq> > <img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('1')" />
            <input id="img_1" type="file" style="display:none;" type="text" value="{$spellgroup.img1}">
            <h3>上传主图1</h3>
          </div>
        </li>
        <li><img src="{$spellgroup.img2}" <eq name="spellgroup.img2" value="">style="display:none;"</eq> width="176" height="172" id="picShow_2" onClick="upimg('2')"/>
          <div class="inner" <neq name="spellgroup.img2" value="">style="display:none;"</neq> > <img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('2')" />
            <input id="img_2" type="file" style="display:none;" type="text" value="{$spellgroup.img2}">
            <h3>上传主图2</h3>
          </div>
        </li>
        <div class="clear"></div>
      </ul>
    </div>
    <div class="button">
      <input type="button" value="上传" onClick="show(1)"/>
    </div>
  </div>
  <!--页面三-->
  <input type="hidden" name="c_imgs" value="{$spellgroup.c_imgs}">
  <div class="detail" id="three" style="display:none;">
    <div class="upload">
      <ul>
        <li><img src="{$spellgroup.img3}" <eq name="spellgroup.img3" value="">style="display:none;"</eq> width="176" height="172" id="picShow_3" onClick="upimg('3')"/>
          <div class="inner" <neq name="spellgroup.img3" value="">style="display:none;"</neq>"><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('3')"/>
          	<input id="img_3" type="file" style="display:none;" type="text" value="{$spellgroup.img3}">
            <h3>上传详情1</h3>
          </div>
        </li>
        <li><img src="{$spellgroup.img4}" <eq name="spellgroup.img4" value="">style="display:none;"</eq> width="176" height="172" id="picShow_4" onClick="upimg('4')"/>
          <div class="inner" <neq name="spellgroup.img4" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('4')"/>
          	<input id="img_4" type="file" style="display:none;" type="text" value="{$spellgroup.img4}">
            <h3>上传详情2</h3>
          </div>
        </li>
        <li><img src="{$spellgroup.img5}" <eq name="spellgroup.img5" value="">style="display:none;"</eq> width="176" height="172" id="picShow_5" onClick="upimg('5')"/>
          <div class="inner" <neq name="spellgroup.img5" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('5')"/>
          	<input id="img_5" type="file" style="display:none;" type="text" value="{$spellgroup.img5}">
            <h3>上传详情3</h3>
          </div>
        </li>
        <li><img src="{$spellgroup.img6}" <eq name="spellgroup.img6" value="">style="display:none;"</eq> width="176" height="172" id="picShow_6" onClick="upimg('6')"/>
          <div class="inner" <neq name="spellgroup.img6" value="">style="display:none;"</neq>><img src="__PUBLIC__/Wx/img/addpic.png" onClick="upimg('6')"/>
          	<input id="img_6" type="file" style="display:none;" type="text" value="{$spellgroup.img6}">
            <h3>上传详情4</h3>
          </div>
        </li>
        <div class="clear"></div>
      </ul>
    </div>
    <div class="button">
      <input type="button" value="上传" onClick="show(1)"/>
    </div>
  </div>
  <!--页面四-->
  <div class="detail" id="four" style="display:none;">
    <div class="evaluate">
      <div class="writ">
        <textarea name="server">{$shop.server}</textarea>
      </div>
      <div class="anonymity" style="background:#f2f2f2;"><span>
        <input type="radio" />
        使用默认拼团须知</span></div>
    </div>
    <div class="button">
      <input type="button" value="保存提交" onClick="show(1)"/>
    </div>
  </div>
</form>

<!----> 

<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
<!--日期显示插件-->
<script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
	$(".anonymity span").click(function(){
		if($(this).hasClass("select")){
			$(this).removeClass("select");
		}else{
			var con='1.参与拼团，达到拼团人次可成团2.在拼团时间内，已成团可继续参团3.若活动截止时间，还未成团，则拼团失败，退还金额4.活动截止后，根据预定数量，次日商家进货5.到货后，社区店进行打包，新鲜保证。你会收到取货通知及取货码，凭取货码取货';
			$("textarea[name='server']").val(con);
			$(this).addClass("select");
		}
	});
});
</script>

<script type="text/javascript">
    $('.del').click(function(){
        $(this).parents('li').css('display','none')
    });
</script>
<script type="text/javascript">
<!--上传产品头部两个图片和详情四个图片-->
function show(num){
	$(".detail").css("display","none");
	if(num==1){$("#one").css("display","");}
	if(num==2){$("#two").css("display","");}
	if(num==3){$("#three").css("display","");}
    if(num==4){$("#four").css("display","");}
	//首页图链接拼接
	$("input[name='h_imgs']").val($("#img_1").attr("value")+','+$("#img_2").attr("value"));
	//详情图链接拼接c_imgs
	$("input[name='c_imgs']").val($("#img_3").attr("value")+','+$("#img_4").attr("value")+','+$("#img_5").attr("value")+','+$("#img_6").attr("value"));
}//end fun
//图片上传
function upimg(num) {
	//input file 模拟点击
	if($("#img_"+num).attr("type")!="file")$("#img_"+num).attr("type","file");
	$("#img_"+num).click();
}//end fun
$("#img_1").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_1");
	var domain = 'http://www.xiangtws.com';
	var proportion = '1:1';  //图片比例
	var imgsrc=$("#picShow_1");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_1").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_1").attr("type","text");
			$("#img_1").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_2").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_2");
	var domain = 'http://www.xiangtws.com';
	var proportion = '1:1';  //图片比例
	var imgsrc=$("#picShow_2");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_2").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_2").attr("type","text");
			$("#img_2").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_3").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_3");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_3");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_3").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_3").attr("type","text");
			$("#img_3").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun

$("#img_4").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_4");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_4");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_4").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_4").attr("type","text");
			$("#img_4").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_5").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_5");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_5");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_5").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_5").attr("type","text");
			$("#img_5").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun
$("#img_6").change(function () {
	var formData = new FormData();
	var picinput = document.getElementById("img_6");
	var domain = 'http://www.xiangtws.com';
	var proportion = '3:2';  //图片比例
	var imgsrc=$("#picShow_6");//img标签
	formData.append('pic', picinput.files[0]);       //将图片信息追加到formdata中
	formData.append('proportion', proportion);       //将图片比例追加到formdata中
	formData.append('domain', domain);       //将图片信息追加到formdata中
	$.ajax({
		url:'http://imgs.xiangtws.com/Api/Index/addPic',
		type:'POST',
		data:formData,                    // 上传formdata封装的数据
		dataType:'JSON',
		cache:false,                      // 不缓存
		processData:false,                // jQuery不要去处理发送的数据
		contentType:false,                // jQuery不要去设置Content-Type请求头
		success:function (data) {           //成功回调
		//回显
			$("#img_6").parent().css("display","none");//父div隐藏
			imgsrc.attr("src",data.url);
			imgsrc.show();
			//input标签类型修改
			$("#img_6").attr("type","text");
			$("#img_6").attr("value",data.url);
		},
		error: function (data,XMLHttpRequest, textStatus, errorThrown) {
			console.log('error');
		}
	});
})//end fun

</script>

</body>
</html>